using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;
using MIMPGameLibrary;

namespace MIMP
{
    /// <summary>
    /// Extends SpriteDisplay to hold a reference to a Hex object associated with the SpriteDisplay.
    /// </summary>
    public class HexDisplay : SpriteDisplay
    {
        private Hex hex;
        /// <summary>
        /// A reference to the Hex object being displayed.
        /// </summary>
        public Hex Hex
        {
            get { return hex; }
            set { hex = value; }
        }
        /// <summary>
        /// Gets a Color to use to display the Hex, based on the Hex's TerrainType.
        /// </summary>
        public Color TerrainColor
        {
            get
            {
                switch (hex.Terrain)
                {
                    case Hex.TerrainType.Field: return Color.PaleGoldenrod; 
                    case Hex.TerrainType.Forest: return Color.ForestGreen; 
                    case Hex.TerrainType.Grass: return Color.LawnGreen; 
                    case Hex.TerrainType.Hills: return Color.SaddleBrown; 
                    case Hex.TerrainType.Mountain: return Color.SlateGray; 
                    case Hex.TerrainType.Swamp: return Color.Olive; 
                    case Hex.TerrainType.Tundra: return Color.Snow; 
                    case Hex.TerrainType.Water: return Color.CornflowerBlue; 
                    default: return Color.Red; 
                }
            }
        }
        /// <summary>
        /// Constructs a new HexDisplay object at origin (0,0) and scale 1.
        /// </summary>
        /// <param name="hexToDisplay">The Hex that this HexDisplay displays.</param>
        public HexDisplay(Hex hexToDisplay)
            :
            this(hexToDisplay, 0, 0, 1, null) { }
        /// <summary>
        /// Constructs a new HexDisplay object with scale 1.
        /// </summary>
        /// <param name="hexToDisplay"></param>
        /// <param name="x">The x coordinate of the origin of the Hex.</param>
        /// <param name="y">The y coordinate of the origin of the Hex.</param>
        public HexDisplay(Hex hexToDisplay, float x, float y)
            :
            this(hexToDisplay, x, y, 1, null) { }
        /// <summary>
        /// Constructs a new HexDisplay object with scale 1 and with the specified sprite.
        /// </summary>
        /// <param name="hexToDisplay"></param>
        /// <param name="x">The x coordinate of the origin of the Hex.</param>
        /// <param name="y">The y coordinate of the origin of the Hex.</param>
        /// <param name="sprite">The Texture2D used to draw the Hex.</param>
        public HexDisplay(Hex hexToDisplay, float x, float y, Texture2D sprite)
            :
            this(hexToDisplay, x, y, 1, sprite) { }
        /// <summary>
        /// Constructs a new HexDisplay object.
        /// </summary>
        /// <param name="hexToDisplay">The Hex that this HexDisplay displays.</param>
        /// <param name="x">The x coordinate of the origin of the Hex.</param>
        /// <param name="y">The y coordinate of the origin of the Hex.</param>
        /// <param name="scale">The factor by which to scale the Hex.</param>
        /// <param name="sprite">The Texture2D used to draw the Hex.</param>
        public HexDisplay(Hex hexToDisplay, float x, float y, float scale, Texture2D sprite) 
            :
            base(x,y,scale,sprite)
        {
            this.hex = hexToDisplay;
        }
    }
}
